﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Warranty.Data.DataContextStorage
{
    public class DataContextFactory
    {
        public static WarrantyEntities GetDataContext() {
            IDataContextStorageContainer dataContextStorageContainer = DataContextStorageFactory.CreateStorageContainer();

            WarrantyEntities warrantyEntities = dataContextStorageContainer.GetDataContext();

            if (warrantyEntities == null) {
                warrantyEntities = new WarrantyEntities();
                dataContextStorageContainer.Store(warrantyEntities);
            }

            return warrantyEntities;
        }
    }
}
